<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('站点小程序列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="case-form">
                <div class="select-list">
                    <ul>
                        <li>
                            站点名称：<input type="text" name="shopName"/>
                        </li>
                        <li>
                            小程序名称：<input type="text" name="appletName"/>
                        </li>
                        <li>
                            <p style="width: 110px">营业状态： </p>
                            <select name="isEnable" th:with="type=${@dict.getType('open_status')}">
                                <option value="">全部</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <p style="width: 110px">审核状态： </p>
                            <select name="reviewStatus" th:with="type=${@dict.getType('applet_review_status')}">
                                <option value="">全部</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <!--<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="back:shopApplet:add">-->
                <!--<i class="fa fa-plus"></i> 新增-->
            <!--</a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('back:shopApplet:edit')}]];
    var deleteFlag = [[${@permission.hasPermi('back:shopApplet:remove')}]];
    const openStatusDict = [[${@dict.getType('open_status')}]]
    const reviewStatusDict = [[${@dict.getType('applet_review_status')}]]
    var prefix = ctx + "back/shopApplet";

    $(function () {
        var options = {
            url: prefix + "/searchList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "店铺",
            columns: [
                {
                    field: 'id',
                    title: 'ID',
                    visible:false
                },
                {
                    field: 'shopId',
                    title: '站点ID'
                },
                {
                    field: 'shopName',
                    title: '站点名称'
                },
                {
                    field: 'appletName',
                    title: '小程序名称'
                },
                {
                    field: 'appletAppId',
                    title: '基本信息',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<label>AppID：</label><span style="font-weight: bold">' + value + '</span>');
                        actions.push('<br/><label>AppSecret：</label><span style="font-weight: bold">' + row.appletSecret + '</span>');
                        return actions.join('');
                    }
                },
                {
                    field: 'appletPayKey',
                    title: '支付信息',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<label>商户号：</label><span style="font-weight: bold">' + row.appletMchId + '</span>');
                        actions.push('<br/><label>支付密钥：</label><span style="font-weight: bold">' + value + '</span>');
                        actions.push('<br/><label>支付证书：</label><span style="font-weight: bold">' + row.appletPayCert + '</span>');
                        return actions.join('');
                    }
                },
                {
                    field: 'isEnable',
                    title: '小程序状态',
                    formatter: function (value, item, index) {
                        return $.table.selectDictLabel(openStatusDict, value);
                    }
                },
                {
                    field: 'reviewStatus',
                    title: '审核状态',
                    formatter: function (value, item, index) {
                        return $.table.selectDictLabel(reviewStatusDict, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + deleteFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove">删除</i></a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>